import wx

class SnakePanel(wx.Panel):
    def __init__(self, parent):
        super(SnakePanel, self).__init__(parent)
        self.Bind(wx.EVT_PAINT, self.OnPaint)

    def OnPaint(self, event):
        dc = wx.PaintDC(self)
        dc.SetBrush(wx.Brush(wx.Colour(0, 128, 0)))  # 设置绿色画刷
        dc.SetPen(wx.Pen(wx.Colour(0, 0, 0), 1))     # 设置黑色画笔

        # 绘制蛇的身体（由多个圆组成）
        snake_body = [(50, 100), (70, 100), (90, 100), (110, 100), (130, 100)]
        for x, y in snake_body:
            dc.DrawCircle(x, y, 10)  # 绘制蛇的身体部分

        # 绘制蛇的头部
        dc.SetBrush(wx.Brush(wx.Colour(0, 100, 0)))  # 设置深绿色画刷
        dc.DrawCircle(150, 100, 15)  # 绘制蛇的头部

        # 绘制蛇的眼睛
        dc.SetBrush(wx.Brush(wx.Colour(255, 255, 255)))  # 设置白色画刷
        dc.DrawCircle(145, 95, 3)  # 左眼
        dc.DrawCircle(155, 95, 3)  # 右眼

        # 绘制蛇的瞳孔
        dc.SetBrush(wx.Brush(wx.Colour(0, 0, 0)))  # 设置黑色画刷
        dc.DrawCircle(145, 95, 2)  # 左眼瞳孔
        dc.DrawCircle(155, 95, 2)  # 右眼瞳孔

        # 绘制蛇的舌头
        dc.SetPen(wx.Pen(wx.Colour(255, 0, 0), 2))  # 设置红色画笔
        dc.DrawLine(160, 100, 170, 95)  # 舌头的一部分
        dc.DrawLine(160, 100, 170, 105)  # 舌头的另一部分

class SnakeFrame(wx.Frame):
    def __init__(self):
        super(SnakeFrame, self).__init__(None, title="蛇图案", size=(300, 200))
        self.panel = SnakePanel(self)
        self.Centre()
        self.Show()

if __name__ == "__main__":
    app = wx.App(False)
    frame = SnakeFrame()
    app.MainLoop()
